<?php
my_component_load('testing' , false);
my_component_load('paging' , false);   
my_component_load('pelatihan_evaluasi' );
$task = isset($_GET['task']) ? $_GET['task'] : ""; 
$id = isset( $_GET['id'] ) ? $_GET['id']:  0;
$kid = isset( $_GET['kid'] ) ? $_GET['kid']:  0;
$modulname="Diklat _BN_ Evaluasi Pelatihan" ;

if($_SERVER['REQUEST_METHOD'] == "POST"){
	switch($task){
		case "edit_peserta_page": 
			submit_peserta($id , $kid );
			generate_my_web("Updated","","plain.php");
			exit; 
			break;
		case   "edit_evaluasi_page" :
			$validatepost = evaluasi_validate($id , $kid);
			if($validatepost)
			{
				$errors = message_multi_error($validatepost);
				$content = $errors;
				$content .= form_evaluasi($id , $kid);
				generate_my_web($content,"","plain.php");
				exit; 
			}else{
				evaluasi_submit($id , $kid);
				$content =  "Updated";
				generate_my_web($content,"","plain.php");
				exit;
			 }
			break;	
		case "detail_evaluasi_entry":
			stor_evaluasi_entry($id,$kid);
			my_direct('index.php?com=pelatihan_evaluasi&task=detail_evaluasi_entry&id='.$id.'&kid='.$kid);
			break;				
	}
}else{
	switch($task){
		case "detail_peserta":
			load_facebox_script();
			$content = detail_peserta_pelatihan($id);
			$pagename =$modulname." _BN_ Daftar Peserta";
			break;	
		case "edit_peserta":
			$title= ($id > '0' ) ?  "Perubahan Data" : "Tambah Data";
			facebox_page('index.php?com='.$_GET['com'].'&task=edit_peserta_page&id='.$id.'&kid='.$kid , $title , 300	); 
			break;	
		case "edit_peserta_page":
			$content  = form_peserta($id , $kid) ;
			generate_my_web($content,"","plain.php");
			exit; 
			break;	
		case "cetak_peserta":	
			@ob_end_clean(); 
			echo'<pre>';
			echo print_plain_peserta($id);
			exit;
		case "detail_evaluasi":
			load_facebox_script();
			$content = detail_evaluasi($id);
			$pagename =$modulname." _BN_ Formulir Evaluasi";
			break;	
		case "edit_evaluasi":
			$title= ($id > '0' ) ?  "Perubahan Data" : "Tambah Data";
			facebox_page('index.php?com='.$_GET['com'].'&task=edit_evaluasi_page&id='.$id.'&kid='.$kid , $title , 300	); 
			break;	
		case "edit_evaluasi_page":
			$content  = form_evaluasi($id , $kid) ;
			generate_my_web($content,"","plain.php");
			exit; 
			break;	
		case "delete_evaluasi":
			delete_evaluasi($kid);
			my_direct('index.php?com='.$_GET['com'].'&task=detail_evaluasi&id='.$id);				
		case "cetak_evaluasi":	
			@ob_end_clean(); 
			echo'<pre>';
			echo print_plain_evaluasi($id);
			exit;
		case "detail_evaluasi_entry":
			load_facebox_script();
			$content = detail_evaluasi_entry($id, $kid);
			$pagename =$modulname." _BN_ Formulir Evaluasi _BN_ Entry";
			break;				
		default:
			load_facebox_script();
			$content =list_pelatihan();
			$pagename=$modulname ;
			break;
	}
}

generate_my_web( $content , $pagename );